package com.jmodata.zxu.controller.manager;

import com.jmodata.zxu.model.DataGrid;
import com.jmodata.zxu.model.Json;
import com.jmodata.zxu.model.PageHelper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

public interface CommonBaseController<T> {

	/**
	 * 列表页面跳转
	 * 
	 * @return
	 */
	@RequestMapping
	public String index();

	/**
	 * 添加页面跳转
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping("add")
	public String add(HttpServletRequest request);

	/**
	 * 更新页面跳转
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping("update")
	public String update(HttpServletRequest request) ;

	/**
	 * 删除页面跳转
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping("delete")
	@ResponseBody
	public Json delete(HttpServletRequest request) throws Exception;

	/**
	 * 更新保存
	 * 
	 * @param request
	 * @param obj
	 * @return
	 */
	@RequestMapping("updateSave")
	@ResponseBody
	public Json updateSave(HttpServletRequest request, T obj) throws Exception;

	/**
	 * 添加保存
	 * 
	 * @param request
	 * @param obj
	 * @return
	 */
	@RequestMapping("addSave")
	@ResponseBody
	public Json addSave(HttpServletRequest request, T obj) throws Exception;

	/**
	 * 列表查询
	 * 
	 * @param request
	 * @param page
	 * @param obj
	 * @return
	 */
	@RequestMapping("list")
	@ResponseBody
	public DataGrid list(HttpServletRequest request, PageHelper page, T obj) throws Exception;
}
